﻿namespace EasyToolkit.ModelDefinition
{
    using System.Collections.Generic;

    public interface IModelDefinitionManager
    {
        /// <summary> Add model configuration data from file</summary>
        /// <param name="configurationFilePath">configurationj file path</param>
        void AddConfigurationFromFile(string configurationFilePath);

        /// <summary> Add model configuration data from xml string</summary>
        /// <param name="xmlString">string containing the xml data</param>
        void AddConfigurationFromXml(string xmlString);

        /// <summary> Return all the accessors defined in the model</summary>
        /// <returns>The model accessors</returns>
        IEnumerable<IModelAccessor> GetAccessors();

        /// <summary> Return the model accessors having 'name' as name</summary>
        /// <param name="name">name of the accessors to return</param>
        /// <returns>All the accessors having 'name' as name.</returns>
        IEnumerable<IModelAccessor> GetAccessor(string name);

        /// <summary>Return all the model types</summary>
        /// <returns>All the types defined in the model.</returns>
        IEnumerable<IModelType> GetModelDataTypes();

        /// <summary> Return the model type having 'name' as name </summary>
        /// <param name="name">Name of the model type to return.</param>
        /// <returns>The model type that has 'name' as name.</returns>
        IModelType GetModelType(string name);

        /// <summary> Resolve (check) the model
        /// Normally, the model parts are resolved at their first use: if the model is not correctly built, an exception is thrown.
        /// Using this method, you can force the model to resolve (check) all its part.
        /// </summary>
        /// <returns>Return an exception if errors found.</returns>
        void ResolveModel();
    }
}
